<%@ page language="java" import="java.util.*,com.ruohi.util.common.*" pageEncoding="UTF-8"%>
<%@page import="java.sql.Connection"%>
<%@page import="com.ruohi.util.dbutil.DBHelper"%>
<%@page import="com.ruohi.manage.PoolManager"%>
<%@page import="com.ruohi.manage.DBType"%><%
	int inviter = CommonString.getFormatInt(request.getParameter("inviter"));	

	String tableName = "gift_member";
	String tablePrefix = Env.getInstance().getProperty("table_prefix");
	String fileds = "id,uuid,add_date,mem_no,mem_name,nick_name,type,state";
	String channelUUID = CommonString.getFormatPara(request.getParameter("channel_uuid"));
	String whereStr = "and inviter=" + inviter;
	String orderByStr = " add_date desc ";
	
	Connection conn = null;
	DBHelper dbHelper = DBHelper.getInstance();
	try{
		conn = PoolManager.getConnection(DBType.BUSINESS);
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		DBHelper.freeConnection(conn);
	}
	
	Map enumMap = (Map)application.getAttribute("enumMap");
	Map isMap = new HashMap();
	isMap.put("","-请选择-");
	isMap.put("1","正常");
	isMap.put("0","禁用");
	
	Map memberTypeMap = new LinkedHashMap();
	memberTypeMap.put("","-请选择-");
	memberTypeMap.putAll(CommonApplication.getEnumChildren("115",application));
	
	List<Map> brandList = (ArrayList)application.getAttribute("giftBrandList");
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title><%=Env.getInstance().getProperty("project_name") %></title>
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/Gray/css/all.css" rel="stylesheet" type="text/css" />
	<link href="/plugin/ui/ligerUI/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
	<link href="/backend/style/style.css" rel="stylesheet" type="text/css" />
	<script src="/plugin/jquery/jquery.min.js" type="text/javascript"></script>
  </head>
  <body>
  	<div class="searchForm">
  		<div class="searchCondition">
  			<div class="searchList">
		  		<div class="searchLeft">用户名</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="mem_no" id="mem_no" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">昵称</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="nick_name" id="nick_name" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">真实姓名</div>
		  		<div class="searchRight">
		  			<input type="text" class="jr_text" name="mem_name" id="mem_name" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">会员类型</div>
		  		<div class="searchRight">
		  			<select name="type" id="type" class="jr_select">
		  				<%=CommonForm.createSelect(memberTypeMap,"") %>
		  			</select>
		  		</div>
		  	</div>
		  	<div class="searchList" style="width:400px;">
		  		<div class="searchLeft">注册时间</div>
		  		<div class="searchRight" style="width:300px;">
		  			<input type="text" class="Wdate jr_text" style="width:120px;" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" name="add_date_start" id="add_date_start" />
		  			-
		  			<input type="text" class="Wdate jr_text" style="width:120px;" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'});" name="add_date_end" id="add_date_end" />
		  		</div>
		  	</div>
		  	<div class="searchList">
		  		<div class="searchLeft">状态</div>
		  		<div class="searchRight">
		  			<select name="state" id="state" class="jr_select">
		  				<%=CommonForm.createSelect(isMap,"") %>
		  			</select>
		  		</div>
		  	</div>
  		</div>
  		<div class="searchBtn">
  			<input type="button" class="btn" onclick="doSearch();" value="查询" /><input type="button" style="margin-left: 5px;" class="btn" onclick="doClearForm();" value="重置" />
  		</div>
  	</div>
  	<div style="clear: left;"></div>
  	
	<div class="l-loading" style="display: block" id="pageloading"></div> 
	<div id="maingrid" style="margin: 0; padding: 0"></div>
	<div style="display: none;"></div>
  </body>
</html>
<script src="/plugin/ui/ligerUI/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="/plugin/date/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="/backend/scripts/common.js" prefix="<%=tablePrefix %>" type="text/javascript"></script>
<script type="text/javascript">
	var grid;
	var windowWidth = 800;
	var windowHeight = 420;
	var channelUUID = '<%=channelUUID %>';
	var tableName = "<%=tableName %>";
	var fields = "<%=fileds %>";
	var whereStr = "<%=whereStr %>";
	var orderBy = "<%=orderByStr %>";
	var columnsArr = [];
	var url = "";
	var conditionStr = "";
	var params = [];
	var myToolbar = {
        items: [{
            text: '打开查询',
            click: function(){
                closeAndOpen();
            },
            icon: 'right'
        }]
    };
	jQuery(function() {
		params.push({'name':'enumNo','value':'106013'});
		grid = new Dev21sunGrid({
			toolbar :myToolbar
		});
		jQuery("#pageloading").hide();
	});
	var is_showData = [{ is_show : 1 , text: '是' }, { is_show : 0 , text: '否'}];
	//列数组
	columnsArr =  [ 
		{ display : '账号/昵称/真实姓名', name : 'mem_no', align : 'center' , type : 'string' , width : 300, render:function(row){
			return "<a class='link' href='javascript:void(0);' onclick='addAndEdit("+row.__index+");'>"+row.mem_no+"/"+row.nick_name+"/"+row.mem_name+"</a>";
		} } ,
		{ display : '注册日期', name : 'add_date', align : 'center' , type : 'date' , width : 120 } ,
		{ display : '会员类型', name : 'type', align:'center', width:120, type:'string', render:function(row){
			return getEnum(row.type);
		} },
		{ display:'状态', name:'state', align:'center', width:100, type:'string', render:function(row){
			return row.state==0 ? "禁用" : "正常";
		} }
	];
	
	/*列表页条件查询*/
	function doSearch(){
		params = [];
		conditionStr = "";
		var mem_no = jQuery("#mem_no").val();
		if(''!=jQuery.trim(mem_no)){
			conditionStr += " and mem_no like '%"+mem_no+"%' ";
		}
		var nick_name = $.trim($("#nick_name").val());
		if(nick_name != ""){
			conditionStr += " and nick_name like '%" + nick_name + "%'";
		}
		var mem_name = jQuery("#mem_name").val();
		if(''!=jQuery.trim(mem_name)){
			conditionStr += " and mem_name like '%"+mem_name+"%' ";
		}
		var start_date = jQuery("#add_date_start").val();
		if(''!=jQuery.trim(start_date)){
			conditionStr += " and add_date > '"+start_date+"' ";
		}
		var end_date = jQuery("#add_date_end").val() ;
		if(''!=jQuery.trim(end_date)){
		    conditionStr += " and add_date < '"+end_date+"'" ;
		}
		var state = jQuery("#state").val();
		if(''!=jQuery.trim(state)){
			conditionStr += " and state = '"+state+"' ";
		}
		var type = $("#type").val();
		if($.trim(type)!=""){
			conditionStr += " and type='" + type + "'";
		}
		params.push({'name':'enumNo','value':'106013'});
		params.push({'name':'tableName','value':tableName});
		params.push({'name':'fields','value':fields});
		params.push({'name':'whereStr','value':whereStr+conditionStr});
		params.push({'name':'orderBy','value':orderBy});
		grid.options.parms=params;
		grid.loadData();
	}
</script>